Open
Conversation
…odule H5Session/H5Dataset/build_h5_dataset load windowed continuous signals from per-session h5 files and expose the .dataset (ConcatDataset) + .subject interface that the DataModule already consumed, so they plug in as a drop-in replacement for pnpl.datasets.CamcanGlasser. The module (and its collate fn) were always dataset-agnostic; renamed to reflect that.
Replace mean/std with median + 1.4826·MAD. For Gaussian data the two are asymptotically identical (1.4826 is the MAD→σ consistency factor), but MAD is unaffected by localised high-amplitude artefacts whose inflated σ otherwise scales the rest of the session down and destroys reconstruction quality on long or noisy recordings.
…l dataset The old implementation preallocated two (n_total_sequences, L, C) float32 tensors on the compute device, which is fine for a ~50-subject CamCAN subset but OOMs on larger datasets — e.g. ~24 GB combined for 277k windows at L=200, C=54. Replace with a streaming pass that accumulates per-session sums of squared error and squared total on the host (O(n_sessions) memory). np.searchsorted maps each batch element to its session in O(log n).
Outlier sessions are now excluded upstream via the curated subset, so robust MAD estimation is no longer needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
H5Session/H5Dataset/build_h5_dataset) as a drop-in replacement forpnpl.datasets.CamcanGlasser, so any session-indexed CSV + per-session .h5 files can feed the tokenizer pipeline.CamcanGlasserDataModule→EphysDataModule(and_collate_camcan→_collate_default) to reflect that the data module is dataset-agnostic; it only requires aConcatDatasetof per-session sub-datasets exposing.subject.H5Sessiondoes per-session z-score standardisation, drops trailing samples that don't fill a window, and re-opens h5 handles per worker PID so forked DataLoader workers don't share a stale handle.get_pveto stream per-session sum-of-squared-error / sum-of-squared-total through the loader instead of preallocating(n_total_sequences, L, C)tensors for originals and reconstructions - unblocks PVE on datasets that don't fit in memory.